package com.twu.biblioteca;

import java.math.BigInteger;

public class User {
    private String userId;
    private String password;
    private String name;
    private long phoneNo;
    private String address;

    public User(String userId, String password, String name, long phoneNo, String address) {
        this.userId = userId;
        this.password = password;
        this.name = name;
        this.phoneNo = phoneNo;
        this.address = address;
    }
    public boolean isValidpassword(String password){
        return this.password.equals(password);
    }

    public String getId() {
        return userId;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (!(o instanceof User)) return false;

        User user = (User) o;

        if (password != null ? !password.equals(user.password) : user.password != null) return false;
        if (userId != null ? !userId.equals(user.userId) : user.userId != null) return false;

        return true;
    }

    @Override
    public String toString() {
        return "User{" +
                "userId='" + userId + '\'' +
                ", password='" + password + '\'' +
                ", name='" + name + '\'' +
                ", phoneNo=" + phoneNo +
                ", address='" + address + '\'' +
                '}';
    }

    @Override
    public int hashCode() {
        int result = userId != null ? userId.hashCode() : 0;
        result = 31 * result + (password != null ? password.hashCode() : 0);
        return result;
    }

}
